home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 14 / Example 14.1 / player.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-30  |  1.9 KB  |  76 lines

  1. #ifndef _RTS_PLAYER_
  2. #define _RTS_PLAYER_
  3.  
  4. #include <vector>
  5. #include "shader.h"
  6. #include "camera.h"
  7. #include "unit.h"
  8. #include "building.h"
  9. #include "terrain.h"
  10. #include "masterAI.h"
  11.  
  12. void LoadPlayerResources(IDirect3DDevice9* m_pDevice);
  13. void UnloadPlayerResources();
  14. float GetCost(int type, bool m_isBuilding);
  15.  
  16. #define HUMAN 0
  17. #define COMPUTER 1
  18. #define NETWORK 2
  19.  
  20. class PLAYER
  21. {
  22.     friend class APPLICATION;
  23.     friend class MASTERAI;
  24.     friend class BUILDING;
  25.     friend class UNIT;
  26.     friend class CONSTRUCT_BUILDING;
  27.     friend class SMALL_ATTACK;
  28.     friend class STRATEGY_MAP;
  29.     public:
  30.         PLAYER(int _teamNo, int _controller, D3DXVECTOR4 _teamCol, INTPOINT startPos, TERRAIN* _terrain, IDirect3DDevice9* _Device);
  31.         ~PLAYER();
  32.  
  33.         MAPOBJECT* AddMapObject(int type, INTPOINT mp, bool m_isBuilding, bool finished);
  34.         void RemoveMapObject(MAPOBJECT *mapObject);
  35.  
  36.         void RenderMapObjects(CAMERA &camera);
  37.         void PaintSelectedMapObjects(CAMERA &camera);
  38.         void UpdateMapObjects(float deltaTime);
  39.         INTPOINT FindClosestBuildingLocation(int buildType, INTPOINT mp);
  40.         void Select(MOUSE &mouse);
  41.         void UnitOrders(MOUSE &mouse, std::vector<PLAYER*> &players, CAMERA &camera);
  42.         INTPOINT GetCenter();
  43.         void IsMapObjectsVisible();
  44.         void Menu(MOUSE &mouse);
  45.  
  46.         void PlaceBuilding(MOUSE &mouse, CAMERA &camera);
  47.         bool HasMapObject(int type, bool m_isBuilding);
  48.         RECT GetBaseArea();
  49.  
  50.         BUILDING* GetAvailableBuilding(int type);
  51.         UNIT* GetAvailableUnit(int type);
  52.  
  53.         //Menu variables
  54.         float money;
  55.         int unitLimit;
  56.  
  57.     private:
  58.         IDirect3DDevice9* m_pDevice;
  59.         std::vector<MAPOBJECT*> m_mapObjects;
  60.         D3DXVECTOR4 m_teamColor;
  61.         TERRAIN *m_pTerrain;
  62.         int m_teamNo, m_buildingToPlace;
  63.         bool m_areaSelect, m_placeBuilding;
  64.         INTPOINT m_startSel, m_teamStartLocation;
  65.  
  66.         UNIT *m_pSelectedUnit;
  67.  
  68.         float m_time;
  69.         float m_nextUnitUpdate;
  70.         int m_unitUpdateIndex;
  71.         int m_controller;
  72.         int m_numKills;
  73.         MASTERAI *m_pAi;
  74. };
  75.  
  76. #endif